package be.ipl.eBar.daoimpl;

import java.util.Calendar;
import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.TemporalType;

import be.ipl.eBar.dao.CommandeDao;
import be.ipl.eBar.domaine.Commande;

@SuppressWarnings("serial")
@Stateless
public class CommandeDaoImpl extends DaoImpl<Commande> implements CommandeDao {

	@Override
	public List<Commande> lister(Calendar date) {
		String query = "select c from Commande c where c.date = ?1";
		return super.liste(query, date, TemporalType.DATE);
	}

	@Override
	public Commande chargerBieres(Commande commande) {
		commande = super.recharger(commande.getId());
		commande.getBieres().size();
		return commande;
	}

}
